package gr.upatras.uniexamtimetable;

import java.util.ArrayList;
import java.util.List;

/**
 * Basic timetable to test main features and classes/
 * 
 * @author spirosag
 */
public class UniExamTimetable {

	/**
	 * Tests the main classes by creating dummy objects and
	 * printing their status
	 */
	private static void testClasses() {

		/* Room testing */
		Room testRoom = new Room("HL5", 007, "HL");
		testRoom.printStatus();
				
		Room defaultRoom = new Room();
		defaultRoom.printStatus();
		
		/* ExamPeriod testing */
		ExamPeriod  testPeriod = new ExamPeriod("Eks_iounioy", 28, 4, 20101105, 20101107);
		testPeriod.printStatus();
		
		ExamPeriod defaultPeriod = new ExamPeriod();
		defaultPeriod.printStatus();
		
		/* ExamForbiddenPeriod testing */
		ExamForbiddenPeriod testExamForbiddenPeriod = new ExamForbiddenPeriod(20101221, 1230, 1400);
		testExamForbiddenPeriod.printStatus();
		
		ExamForbiddenPeriod defaultExamForbiddenPeriod = new ExamForbiddenPeriod();
		defaultExamForbiddenPeriod.printStatus();
		
		/* CorrelationEstimation testing */
		CorrelationEstimation testCorrelationEstimation = 
			new CorrelationEstimation("ee101", "ee231", 70);
		testCorrelationEstimation.printStatus();
				
		CorrelationEstimation defaultCorrelationEstimation = 
			new CorrelationEstimation();
		defaultCorrelationEstimation.printStatus();
				
		/* RequiredClass testing */
		RequiredClass testRequiredClass = new RequiredClass("amfitheatro", 
				3, true, false);
		testRequiredClass.PrintStatus();
		
		RequiredClass defaultRequiredClass = new RequiredClass();
		defaultRequiredClass.PrintStatus();
				
		/* Examiner testing */
		ArrayList<Exam> examCodes = new ArrayList<Exam>();

		Examiner testExaminer = new Examiner("Bitsoris", "SAE", examCodes);
		testExaminer.printStatus();
				
		Examiner defaultExaminer = new Examiner();
		defaultExaminer.printStatus();
		
		/* Exam testing */
		ArrayList<Examiner> examiners = new ArrayList<Examiner>();
		examiners.add(testExaminer);
		ArrayList<RequiredClass> requiredClasses = new ArrayList<RequiredClass>();
		requiredClasses.add(testRequiredClass);
		ArrayList<ExamForbiddenPeriod> forbiddenPeriods = new ArrayList<ExamForbiddenPeriod>();
		forbiddenPeriods.add(testExamForbiddenPeriod);
		ArrayList<CorrelationEstimation> correlationEstimations = new 
				ArrayList<CorrelationEstimation>();	
		correlationEstimations.add(testCorrelationEstimation);		
		
		Exam testExam = new Exam("algorithms", "ee101", 5, "HY", examiners, "oral",
				forbiddenPeriods, correlationEstimations, requiredClasses);
		testExam.printStatus();
		
		
		Exam defaultExam = new Exam();
		defaultExam.printStatus();
	}
	
	/**
	 * Tests the json im/exporting feature.
	 * It creates dummy  objects and im/exports them from/to
	 * specific json files.
	 */
	private static void testJsonFiles() {
		Room room1 = new Room();
		Room room2 = new Room();
		List<Room> rooms = new ArrayList<Room>();
		rooms.add(room1);
		rooms.add(room2);
		Room.exportToJson(rooms, "rooms.json");
		Room.importFromJson("rooms.json");
		
		CorrelationEstimation cor1 = new CorrelationEstimation();
		CorrelationEstimation cor2 = new CorrelationEstimation();
		List<CorrelationEstimation> corList = new  ArrayList<CorrelationEstimation>();
		corList.add(cor1);
		corList.add(cor2);
		CorrelationEstimation.exportToJson(corList, "corEst.json");
		CorrelationEstimation.importFromJson("corEst.json");
		
		ExamPeriod examp1 = new ExamPeriod();
		ExamPeriod examp2 = new ExamPeriod();
		List<ExamPeriod> examPeriods = new ArrayList<ExamPeriod>();
		examPeriods.add(examp1);
		examPeriods.add(examp2);
		ExamPeriod.exportToJson(examPeriods, "examperiods.json");
		ExamPeriod.importFromJson("examperiods.json");
		
		ExamForbiddenPeriod examForP1 = new ExamForbiddenPeriod();
		ExamForbiddenPeriod examForP2 = new ExamForbiddenPeriod();
		List<ExamForbiddenPeriod> examForbPeriods = new ArrayList<ExamForbiddenPeriod>();
		examForbPeriods.add(examForP1);
		examForbPeriods.add(examForP2);
		ExamForbiddenPeriod.exportToJson(examForbPeriods, "examForbPeriods.json");
		ExamForbiddenPeriod.importFromJson("examForbPeriods.json");
		
		RequiredClass reqClass1 = new RequiredClass();
		RequiredClass reqClass2 = new RequiredClass();
		List<RequiredClass> reqClasses = new ArrayList<RequiredClass>();
		reqClasses.add(reqClass1);
		reqClasses.add(reqClass2);
		RequiredClass.exportToJson(reqClasses, "reqClasses.json");
		RequiredClass.importFromJson("reqclasses.json");
		
		Exam exam1 = new Exam();
		Exam exam2 = new Exam();
		List<Exam> exams = new ArrayList<Exam>();
		exams.add(exam1);
		exams.add(exam2);
		Exam.exportToJson(exams, "exams.json");
		Exam.importFromJson("exams.json");
		
		Examiner examiner1 = new Examiner();
		Examiner examiner2 = new Examiner();
		List<Examiner> examiners = new ArrayList<Examiner>();
		examiners.add(examiner1);
		examiners.add(examiner2);
		Examiner.exportToJson(examiners, "examiners.json");
		Examiner.importFromJson("examiners.json");
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
	}

}
